x = int(input())
minX = float('inf')
li = []

for _ in range(x):
    shoudaoT, xiangyingT = map(int, input().split())
    if xiangyingT < 128:
        maxT = shoudaoT + xiangyingT
    else:
        mant = xiangyingT & 0x0f
        exp = (xiangyingT >> 5) & 0x07
        maxT = (mant | 0x10) << (exp + 3)

    # li.append(maxT)
    if maxT < minX:
        minX = maxT

# print(min(li))
print(minX)